package com.atjava.nebula.web.listener;

import java.util.Iterator;
import java.util.Map;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.atjava.nebula.web.util.PropertyUtils;
import com.atjava.nebula.web.view.XmlViewConfiguration;

public class ViewConfigListener implements ServletContextListener{

	public void contextInitialized(ServletContextEvent sce) {
		
		Map<String, String> properties = PropertyUtils.getPropertyMap();
		
		for (Iterator<String> iterator = properties.keySet().iterator(); iterator.hasNext();) {
			String key = iterator.next();
			String [] args = key.split("\\.");
			
			XmlViewConfiguration.readViewConfig(args[0], args[1]);
			
		}
		
	}

	public void contextDestroyed(ServletContextEvent sce) {
		
		
	}

}
